import { http } from '../http/axios';

export interface User {
  id: number;
  username: string;
  email: string;
  role: string;
}

export const userService = {
  // 用户登录
  login: (credentials: { username: string; password: string }) => {
    return http.post('/auth/login', credentials);
  },

  // 获取用户信息
  getProfile: (): Promise<User> => {
    return http.get('/user/profile');
  },

  // 退出登录
  logout: (): Promise<void> => {
    return http.post('/auth/logout');
  },
};